{% extends 'base.htm' %}
{% from 'macros.htm' import map_image %}
{% set title = 'Set Location' %}

{% macro geocode_result_fmt(result) -%}
    {% set geometry = result.geometry %}
    {% set location = geometry.location %}

    <a class="button" href="/coords?{{ 
	{
	    'geolat' : location.lat,
	    'geolong' : location.lng,
	} | urlparms
    }}">{{ result.formatted_address|e }}</a>

    <br>{{ [ location.lat, location.lng ] | convcoords }}
    {{ map_image(location.lat, location.lng) }}
{%- endmacro %}

{% block body %}
<p>Did you mean?
<ul class="vlist">
    {% for result in results %}
	<li>{{ geocode_result_fmt(result) }}</li>
    {% else %}
	<p>No search results.</p>
    {% endfor %}
</ul>

<form class="formbox" action="/setloc" method="get">
Search again? <input class="inputbox" type="text" name="newloc" size="16"><input class="submitbutton" type="submit" value="Go"></form>
{% endblock %}

{# vim:set ft=htmldjango tw=0: #}
